#ifndef LOADER_H
#define LOADER_H

#include <QObject>
#include <QMap>
#include <QCoreApplication>
#include <QString>



#if defined(SHARELIB_LIBRARY)
#  define SHARELIB_EXPORT Q_DECL_EXPORT
#else
#  define SHARELIB_EXPORT Q_DECL_IMPORT
#endif


typedef int (*_libMain_)(char *args);


class QLibrary;
class Loader : public QObject
{
    Q_OBJECT
public:
    explicit Loader(int argc, char *argv[], QObject *parent = nullptr);
    virtual ~Loader();

public:
    bool RunExecutableProgram(const QString& strProgram, const QStringList& strlistArguments);
    int RunDynamicLib(const QString& libName, const QString& libFn = "libMain", const QString& strArguments = "");


private:
    //int m_argc = 0;
    //char **m_argv = nullptr;

    QMap<QString, QLibrary*> mapLib;

signals:

};

#endif // LOADER_H
